#include "flash_blob.h"

static const uint32_t flash_code[] =
{
    0XE00ABE00,0X062D780D,0X24084068,0XD3000040,0X1E644058,0X1C49D1FA,0X2A001E52,0X4770D1F2,
    0X49784879,0X49796041,0X47706041,0X4A754876,0X49766042,0X60826041,0X21006081,0X68C16001,
    0X43112214,0X69C060C1,0XD4060740,0X49704871,0X21066001,0X49706041,0X20006081,0X486A4770,
    0X22806901,0X61014311,0X15826901,0X61014391,0X47702000,0X2101B530,0X06C94863,0X68C16141,
    0X43212414,0X690160C1,0X43292504,0X69016101,0X43112240,0X49616101,0XE0004A5E,0X68C36011,
    0XD1FB07DB,0X43A96901,0X68C16101,0XD0044221,0X432168C1,0X200160C1,0X2000BD30,0XB530BD30,
    0X61484951,0X231468C8,0X60C84318,0X6088484D,0X6088484E,0X24206908,0X61084320,0X22406908,
    0X61084310,0X4A4B484D,0X6010E000,0X07ED68CD,0X6908D1FB,0X610843A0,0X401868C8,0X68C8D003,
    0X60C84318,0XBD302001,0XF7FFB530,0X4D44FF89,0XF7FF4628,0X493CFFD4,0X4A426908,0X61084010,
    0X24106908,0X61084320,0X8028483F,0X4A39483B,0X6010E000,0X07DB68CB,0X6908D1FB,0X610843A0,
    0X221468C8,0XD0034010,0X431068C8,0X200160C8,0XB500BD30,0XFFD8F7FF,0XFF8CF7FF,0XF7FF4833,
    0X2000FFAE,0XB530BD00,0X68CA4927,0X431A2314,0X690A60CA,0X43222402,0X6148610A,0X22406908,
    0X61084310,0X4A234825,0X6010E000,0X07ED68CD,0X6908D1FB,0X610843A0,0X401868C8,0X68C8D003,
    0X60C84318,0XBD302001,0X47702001,0X4D16B5F0,0X08491C49,0X004968EB,0X43232404,0X271460EB,
    0XE01A4C16,0X2601692B,0X612B4333,0X80038813,0XE0004B10,0X68EE601C,0XD1FB07F6,0X085B692B,
    0X612B005B,0X423B68EB,0X68E8D004,0X60E84338,0XBDF02001,0X1E891C80,0X29001C92,0X2000D1E2,
    0X0000BDF0,0X45670123,0X40022000,0XCDEF89AB,0X00005555,0X40003000,0X00000FFF,0X0000AAAA,
    0X1FFFF800,0X00001FEF,0X00005AA5,0X1FFE0000,0X00000000,
};

const program_target_t flash_algo_MM32F031X =
{
    0X2000002D,  // Init
    0X2000005F,  // UnInit
    0X20000153,  // EraseChip
    0X20000167,  // EraseSector
    0X200001AD,  // ProgramPage

    // BKPT : start of blob + 1
    // RSB  : address to access global/static data
    // RSP  : stack pointer
    {
        0X20000001,
        0X20000C00,
        0X20001000,
    },

    0x20000400,                      // mem buffer location
    0x20000000,                      // location to write prog_blob in target RAM
    sizeof(flash_code),              // prog_blob size
    flash_code,                      // address of prog_blob
    0x00000400,                      // ram_to_flash_bytes_to_be_written
};
